﻿using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Xms.Abp.Application.Dtos;
using Xms.Abp.Application.Services;

namespace Xms.Abp.AspNetCore.Mvc;

public abstract class XmsCrudPageController<TService, TEntityDto, TKey>
    : XmsCrudPageController<TService, TEntityDto, TKey, PagedSortedAndFilterParameter>
    where TService : IXmsCrudAppService<TEntityDto, TKey>
    where TEntityDto : IEntityDto<TKey>
{

}
public abstract class XmsCrudPageController<TService, TEntityDto, TKey, TPagedParameter>
    : XmsCrudPageController<TService, TEntityDto, TKey, TPagedParameter, TEntityDto>
    where TService : IXmsCrudAppService<TEntityDto, TKey, TPagedParameter, TEntityDto>
    where TEntityDto : IEntityDto<TKey>
    where TPagedParameter : class, IPagedSortedAndFilterParameter
{

}
public abstract class XmsCrudPageController<TService, TEntityDto, TKey, TPagedParameter, TCreateParameter>
    : XmsCrudPageController<TService, TEntityDto, TKey, TPagedParameter, TCreateParameter, TCreateParameter>
    where TService : IXmsCrudAppService<TEntityDto, TKey, TPagedParameter, TCreateParameter, TCreateParameter>
    where TEntityDto : IEntityDto<TKey>
    where TPagedParameter : class, IPagedSortedAndFilterParameter
{

}
public abstract class XmsCrudPageController<TService, TEntityDto, TKey, TPagedParameter, TCreateParameter, TUpdateInput>
    : XmsCrudPageController<TService, TEntityDto, TEntityDto, TKey, TPagedParameter, TCreateParameter, TUpdateInput>
    where TService : IXmsCrudAppService<TEntityDto, TKey, TPagedParameter, TCreateParameter, TUpdateInput>
    where TEntityDto : IEntityDto<TKey>
    where TPagedParameter : class, IPagedSortedAndFilterParameter
{

}
public abstract class XmsCrudPageController<TService, TDetailsResult, TPagingListResult, TKey, TPagedParameter, TCreateParameter, TUpdateInput>
    : XmsCrudPageController<TService, TDetailsResult, TPagingListResult, TDetailsResult, TKey, TPagedParameter, TCreateParameter, TUpdateInput>
    where TService : IXmsCrudAppService<TDetailsResult, TPagingListResult, TDetailsResult, TKey, TPagedParameter, TCreateParameter, TUpdateInput>
    where TDetailsResult : IEntityDto<TKey>
    where TPagingListResult : IEntityDto<TKey>
    where TPagedParameter : class, IPagedSortedAndFilterParameter
{

}
public abstract class XmsCrudPageController<TService, TDetailsResult, TPagingListResult, TExportResult, TKey, TPagedParameter, TCreateParameter, TUpdateInput>
    : XmsCrudPageController<TService, TDetailsResult, TPagingListResult, TExportResult, TExportResult, TKey, TPagedParameter, TCreateParameter, TUpdateInput>
    where TService : IXmsCrudAppService<TDetailsResult, TPagingListResult, TExportResult, TKey, TPagedParameter, TCreateParameter, TUpdateInput>
    where TDetailsResult : IEntityDto<TKey>
    where TPagingListResult : IEntityDto<TKey>
    where TPagedParameter : class, IPagedSortedAndFilterParameter
{

}
public abstract class XmsCrudPageController<TService, TDetailsResult, TPagingListResult, TExportResult, TImportParameter, TKey, TPagedParameter, TCreateParameter, TUpdateInput>
    : XmsPageController<TService>
    where TService : IXmsCrudAppService<TDetailsResult, TPagingListResult, TExportResult, TImportParameter, TKey, TPagedParameter, TCreateParameter, TUpdateInput>
    where TDetailsResult : IEntityDto<TKey>
    where TPagingListResult : IEntityDto<TKey>
    where TPagedParameter : class, IPagedSortedAndFilterParameter
{
    [HttpGet]
    [Route("page.html")]
    public virtual Task<ViewResult> Page()
        => Task.FromResult(View());

    [HttpGet]
    [Route("{id}.html")]
    public virtual async Task<ViewResult> Details(TKey id)
        => View(await CurrentService.GetAsync(id));

    [HttpGet]
    [Route("{id}/update.html")]
    public virtual async Task<ViewResult> Update(TKey id)
        => View(await CurrentService.GetAsync(id));

    [HttpGet]
    [Route("create.html")]
    public virtual Task<ViewResult> Create()
        => Task.FromResult(View());
}

